
import java.util.Properties;
import javax.mail.Session;
import javax.mail.Store;

public class JavaGMail {

    public static void main(String args[]) {
        Properties props = System.getProperties();
        props.setProperty("mail.store.protocol", "imaps");
        props.setProperty("mail.imaps.port", "993");
        try {
            Session session = Session.getDefaultInstance(props, null);
            Store store = session.getStore("imaps");
            store.connect("imap.gmail.com", "paulsedeen@gmail.com", "thereisnospooner1");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}